package com.leetcode.LC;

import java.util.ArrayList;

public class LC1389 {
    public int[] createTargetArray(int[] nums, int[] index) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            list.add(index[i],nums[i]);
        }
        int i=-1;
        for (Integer integer : list) {
            i++;
            nums[i]=integer;
        }
        return nums;
    }

    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(0,1);
        list.add(0,2);
        list.add(0,3);
        for (Integer integer : list) {
            System.out.print(integer);
        }
    }
}
